<template>
	<view v-if="info.courseName" class="box" :style="theme">
		<view class="content">
			<view class="head flex_between flex">
				<image :src="info.courseImage" class="left"></image>
				<view class="right">
					<view class="xbt">{{info.courseName}}</view>
					<view class="flex_between flex">
						<text v-if="info.teacherName">教练：{{info.teacherName}}</text>
						<text>总课时：{{info.classNum || 0}}课时</text>
					</view>
					<view v-if="info.courseEndDate" class="flex_between flex">
						<text>结课时间：{{info.courseEndDate}}</text>
					</view>
				</view>
			</view>
			<view class="student">
				<view class="bt flex flex_between">
					<text>人员名称</text>
					<text>身份证号</text>
					<text>剩余课时</text>
				</view>
				<view v-for="(item, index) in info.studentList" :key="index" class="nr flex flex_between">
					<text>{{item.studentName}}</text>
					<text>{{item.idCard || ''}}</text>
					<text>{{item.num}}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				info: {}
			}
		},
		onLoad(ops) {
			this.getDetail(ops.id, ops.studentId)
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			getDetail(id, studentId) {
				this.$app.ajax({
					api: this.$api.productDetail(),
					data: {
						param: { id, studentId }
					}
				}).then((res) => {
					if (res.errorCode === '000000') {
						this.info = res.record
					}
				}).catch(() => {})
			}
		}

	}
</script>
<style scoped lang="scss">
	.content {
		width: 690rpx;
		background: #FFFFFF;
		box-sizing: border-box;
		padding: 30rpx;
		margin: 30rpx auto 0;
		border-radius: 8rpx;
		.head {
			.left {
				width: 180rpx;
				height: 136rpx;
				flex: none;
			}
			.right {
				flex: 1;
				margin-left: 24rpx;
				view {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					margin-top: 15rpx;
					color: #333333;
					&.xbt {
						font-size: 30rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: Medium;
						margin-top: 0;
						color: #222222;
					}
				}
			}
		}
		.student {
			border-top: 1px solid #E5E5E5;
			padding-top: 30rpx;
			margin-top: 30rpx;
			view {
				font-size: 26rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #666666;
				text-align: center;
				margin-bottom: 20rpx;
				&.bt {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #222222;
				}
				&:last-of-type {
					margin-bottom: 0;
				}
				text {
					flex: 1;
					&:nth-of-type(2) {
						flex: 2;
					}
				}
			}
		}
	}
</style>
